package test;



import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;

public class RequestService {

	HttpClient httpClient;
	HttpPost httpPost;
	List<NameValuePair> params;
	HttpEntity httpEntity;
	HttpResponse response;

	public RequestService(List<NameValuePair> params) {
		this.params = params;

	}
	public void sendToService() {

		try {
			httpClient = new DefaultHttpClient();
			httpPost = new HttpPost("URL");
			httpEntity = new UrlEncodedFormEntity(params, HTTP.UTF_8);
			response = httpClient.execute(httpPost);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public HttpClient getHttpClient() {
		return httpClient;
	}

	public void setHttpClient(HttpClient httpClient) {
		this.httpClient = httpClient;
	}

	public HttpPost getHttpPost() {
		return httpPost;
	}

	public void setHttpPost(HttpPost httpPost) {
		this.httpPost = httpPost;
	}

	public List<NameValuePair> getParams() {
		return params;
	}

	public void setParams(List<NameValuePair> params) {
		this.params = params;
	}

	public HttpEntity getHttpEntity() {
		return httpEntity;
	}

	public void setHttpEntity(HttpEntity httpEntity) {
		this.httpEntity = httpEntity;
	}

	public HttpResponse getResponse() {
		return response;
	}

	public void setResponse(HttpResponse response) {
		this.response = response;
	}

}
